set the member of sprite the spriteNum of me = the normalMember of me
set the Setting of me = 0
else -- setting "ON"
set the member of sprite the spriteNum of me = the toggleMember of me
set the Setting of me = 1
end if
updateStage
end
on beginSprite me
set s = the spriteNum of me
set the normalMemberNum of me = the memberNum of sprite s
set the imageCastLib of me = the number of castLib ¼
the castLibNum of sprite s
set the normalMember of me = member the normalMemberNum of me ¼
of castLib the imageCastLib of me
set the toggleMember of me = member the toggleMemberNum of me ¼
of castLib the imageCastLib of me
SetValue( me, the Setting of me )
end
on getPropertyDescriptionList
if the currentspritenum = 0 then
set memdefault = 0
else
set memref = the member of sprite the currentspritenum
set castlibnum = the castlibnum of memref
set memdefault = member (the membernum of member memref + 1) of castlib castlibnum
end if
set p_list = [ ¼
#toggleMemberNum: [ #comment: "Toggle Image:", ¼
#format: #graphic, ¼
#default: memdefault ], ¼
#Setting: [ #comment: "Initially Toggled:", ¼
#format: #boolean, ¼
#default: FALSE ] ¼
]
return p_list
end
on SetToggleValue me, v_me
-- duplicate of SetValue, used by radioButton behavior
if v_me = 0 then -- setting "OFF"
set the member of sprite the spriteNum of me = the normalMember of me
set the Setting of me = 0
else -- setting "ON"
set the member of sprite the spriteNum of me = the toggleMember of me
set the Setting of me = 1
end if
updateStage
end
on getBehaviorDescription
return ¼
"Makes a sprite work as a toggle button with automatic highlighting and mouse tracking. The behavior responds when clicked, or when the SetToggleValue or Toggle messages are receieved. Use the the UI Radio Group behavior to control toggle buttons in radio button groups." & RETURN & ¼
"PARAMETERS:" & RETURN & ¼
"ò Toggle Image - Choose the cast member to display when the button is toggled." & RETURN & ¼
"ò Initially Toggled - Turn this option to make the button toggled when it first appears." & RETURN & ¼
"MESSAGES:"& RETURN & ¼
"ò SetToggleValue {TRUE or FALSE} - Sets the toggle button."& RETURN & ¼